#!/usr/bin/env python3
import npyscreen
import curses
from include import x_realx_class


class App(npyscreen.StandardApp):
    def onStart(self):
        self.addForm("MAIN", MainForm, name="Hello Habr!")
class InputBox2(x_realx_class,npyscreen.BoxTitle):
    _contained_widget = npyscreen.MultiLineEdit

class MainForm(x_realx_class,npyscreen.FormBaseNew):		



    def create(self):
        self.add_event_hander("event_value_edited", self.event_value_edited)
        new_handlers = {
            # Устанавливаем ctrl+Q для выхода
            "^Q": self.exit_func,
            # Устанавливаем alt+enter для очистки inputbox
            curses.ascii.alt(curses.ascii.NL): self.inputbox_clear
        }
        self.add_handlers(new_handlers)
        self.InputBox2 =self.add(self,npyscreen.Button,name="jytjuy", value="text", relx=x_realx_class0.x(0), rely=0)


		
        y, x = self.useable_space()
        self.InputBox2 = self.add(InputBox2, footer="No editable", editable=True, relx=0, rely=0, width=40,height=30)
        self.InputBox2 = self.add(InputBox2, footer="Off editable", editable=True, relx=41, rely=0, width=60,height=30)

		
			#//self.add(npyscreen.TitleSlider);
    def event_value_edited(self, event):
        self.InputBox2.value = "HI PUTIN"
        self.InputBox2.display()

    def inputbox_clear(self, _input):
        self.InputBox2.display()
#		self.InputBox3.display()
    def exit_func(self, _input):
        exit(0)

x_realx_class0=x_realx_class();
MyApp = App()
MyApp.run()
